<style>
    td {
        border: 1px solid #D9E4EB;
    }

    th {
        border: 1px solid #D9E4EB;
        text-align: center;
    }
</style>
<form id="setareas" style="margin: 10px">
    <div style="margin:10px 20px;"></div>
    <table cellspacing="8" cellPadding="4" width="100%">
        <input type="hidden" name="id" value="<{$companies.company_id}>">
        <tr>
            <td width="100" class="nboit-validatebox">单位名称：</td>
            <td><input class="easyui-textbox" type="text" name="name" prompt="单位名称" value="<{$companies.name}>"
                       style="width:auto" data-options="required:true"/></td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">单位地址：</td>
            <td><input class="easyui-textbox" type="text" prompt="单位地址" name="address" value="<{$companies.address}>"
                       style="width:auto" data-options="required:true"/></td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">所属区域：</td>
            <td>
                <select name="area_id" style="width:200px;" class="easyui-combobox" panelMaxHeight="200px"
                        data-options="editable:true,panelHeight:'auto',required:true" 
                        required="true">
                    <option value="-1">请选择所属区域</option>
                    <volist name="areas_list" id="name">
                        <if condition="$companies['area_id']==$key">
                            <option value="<{$key}>" selected><{$name}></option>
                            <else/>
                            <option value="<{$key}>"><{$name}></option>
                        </if>

                    </volist>
                </select>
            </td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">所属行政区域：</td>
            <!--<td>-->
                <!--<input id="province" name="district[province]" style="width:80px;" class="easyui-combobox"-->
                       <!--panelMaxHeight="100px" data-options="-->
                 <!--valueField: 'name', textField: 'name',-->
                 <!--url: '<{:U('admin/operation/getCityCountyInfo')}>',onSelect: function(rec){ var url = '<{:U('admin/operation/getCityCountyInfo')}>?level=2&name='+rec.name;-->
                 <!--$('#city').combobox('reload', url); },required:true" value="<{$companies.district.province}>">-->
                <!--<input id="city" name="district[city]" style="width:150px;" class="easyui-combobox"-->
                       <!--panelMaxHeight="100px" data-options="-->
                 <!--valueField: 'name', textField: 'name',-->
                 <!--onSelect: function(rec){ var url = '<{:U('admin/operation/getCityCountyInfo')}>?level=3&name='+rec.name;-->
                 <!--$('#county').combobox('reload', url); },required:true" value="<{$companies.district.city}>">-->
                <!--<input id="county" name="district[county]" style="width:150px;" class="easyui-combobox"-->
                       <!--panelMaxHeight="100px" data-options="valueField:'name',textField:'name',required:true" value="<{$companies.district.county}>">-->
            <!--</td>-->
            <td>
                <input id="province" name="district[province]" style="width:80px;" class="easyui-combobox"
                       panelMaxHeight="100px" required="true" value="<{$companies.district.province}>">
                <input id="city" required="true" name="district[city]" style="width:150px;" class="easyui-combobox"
                       panelMaxHeight="100px" value="<{$companies.district.city}>">
                <input id="county" required="true" name="district[county]" style="width:150px;" class="easyui-combobox"
                       panelMaxHeight="100px" value="<{$companies.district.county}>">
            </td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">所属街道：</td>
            <td>
                <input class="easyui-textbox" type="text" name="subdistrict" prompt="填入所属街道"
                       value="<{$companies.subdistrict}>" style="width:100%" data-options="required:true"/>
            </td>
        </tr>
        <tr>
            <td width="100">统一社会信用码：</td>
            <td><input class="easyui-textbox" type="text" name="ucc" prompt="社会信用码" value="<{$companies.ucc}>"
                       style="width:auto"/></td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">单位负责人：</td>
            <td>
                <input type="text" class="easyui-textbox" name="principal" value="<{$companies.principal}>" data-options="required:true">
            </td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">负责人电话：</td>
            <td><input class="easyui-textbox" type="text" name="phone" value="<{$companies.phone}>"
                       style="width:auto" data-options="required:true"/></td>
        </tr>
        <tr>
            <td width="100" class="nboit-validatebox">单位管理员：</td>
            <td>
                <select name="userid" id='set_cp_userid' class="easyui-combobox"   data-options="panelHeight:'100px',width:'100px'" panelMaxHeight="200px" 
                required="true">
                    <volist name="manager_list" id="name">
                        <if condition="$key==$companies['userid']">
                            <option value="<{$key}>" selected><{$name}></option>
                            <else/>
                            <option value="<{$key}>" ><{$name}></option>
                        </if>
                    </volist>
                </select>
            </td>
        </tr>
        <!--<tr>-->
            <!--<td width="100">单位证书：</td>-->
            <!--<td>-->
                <!--<input class="easyui-filebox" name="file[certificate_image]" value="<{$companies.certificate_image}>"-->
                       <!--multiple buttonText="选择" style="width:40%">-->
            <!--</td>-->
        <!--</tr>-->
        <!--<tr>-->
            <!--<td width="100">LOGO：</td>-->
            <!--<td>-->
                <!--<input class="easyui-filebox" name="file[logo]" value="<{$companies.logo}>" multiple buttonText="选择"-->
                       <!--style="width:40%">-->
            <!--</td>-->
        <!--</tr>-->
    </table>
</form>

<script type="text/javascript">
    $(function () {
        loadqsfCombobox();
    });

    function loadqsfCombobox() {
        var province = "<{$companies.district.province}>";
        var city = "<{$companies.district.city}>";
        var county = "<{$companies.district.county}>";
        $('#province').combobox({
            url: "<{:U('admin/operation/getCityCountyInfo')}>",
            valueField: 'id',
            textField: 'name',
            filter: function (q, row) {
                var opts = $(this).combobox('options');
                return row[opts.textField].indexOf(q) > -1;
            },
            onLoadSuccess: function () {
                var url = "<{:U('admin/operation/getCityCountyInfo')}>?level=2&name=" + province;
                $("#city").combobox('reload', url);
            },
            onSelect: function (rec) {
                $("#city").combobox('clear');
                var url = "<{:U('admin/operation/getCityCountyInfo')}>?level=2&name=" + rec.name;
                $("#city").combobox('reload', url);
            },
            loadFilter: function (oData) {
                var data = oData;
                for (var i in data) {
                    data[i].id = data[i].name;
                }
                return data;
            }
        });
        //
        $('#city').combobox({
            url: '',
            valueField: 'id',
            textField: 'name',
            filter: function (q, row) {
                var opts = $(this).combobox('options');
                return row[opts.textField].indexOf(q) > -1;
            },
            onLoadSuccess: function () {
                var url = "<{:U('admin/operation/getCityCountyInfo')}>?level=3&name=" + city;
                $("#county").combobox('reload', url);
            },
            onSelect: function (rec) {
                $("#county").combobox('clear');
                var url = "<{:U('admin/operation/getCityCountyInfo')}>?level=3&name=" + rec.name;
                $("#county").combobox('reload', url);
            },
            loadFilter: function (oData) {
                var data = oData;
                for (var i in data) {
                    data[i].id = data[i].name;
                }
                return data;
            }
        });
        //
        $('#county').combobox({
            url: '',
            valueField: 'id',
            textField: 'name',
            filter: function (q, row) {
                var opts = $(this).combobox('options');
                return row[opts.textField].indexOf(q) > -1;
            },
            onLoadSuccess: function () {
                $('#county').combobox('setValue', county)
            },
            loadFilter: function (oData) {
                var data = oData;
                for (var i in data) {
                    data[i].id = data[i].name;
                }
                return data;
            }
        });
    };
</script>